<?php
	/**
	 *	Wap Portal Server
	 *
	 *	Copyright (C) 2002 - 2004 Emir Sakic
	 *
	 *	Wap Portal Server
	 *	Developer: Emir Sakic - saka@hotmail.com
	 *  Homepage: http://www.sakic.net
	 *	Date: 15/03/2004
	 * 	Version #: 1.2
	**/

$wmlsession = 1;
require("../regglobals.php");

// send wml headers
header("Content-type: text/vnd.wap.wml\n");
echo("<?xml version=\"1.0\"?>\n");
echo("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n");
?>

<wml>

<card id="sendmail" title="Send E-mail">
<p>
<?
if ($your_email && $send_to && $message) {
	if (NotValidEmail($your_email) || NotValidEmail($send_to)) {
		print "Please enter valid e-mail!";
	} else {
		$message = $message."\n
Check out Wap Portal Server
http://www.sakic.net/wps";
		// determine whether email was properly sent
		if (@mail($send_to, $subject, $message,
		    "From: $your_email\n"
		   ."X-Mailer: PHP/" . phpversion())) :
			print "E-mail has been successfully sent.";
		else :
			print "Error! E-mail could not be sent.";
		endif;
	}
} else {
	print "Please go back and complete all fields!";
}
?>
</p>
<p align="center">
<anchor>Back
<prev/>
</anchor>
</p>
</card>

</wml>

<?
function NotValidEmail($email) {
	if (eregi("^([._a-z0-9-]+[._a-z0-9-]*)@(([a-z0-9-]+\.)*([a-z0-9-]+)(\.[a-z]{2,3}))$", $email)) {
		return FALSE;
	} else {
		return TRUE;
	}
}
?>